namespace GG.Tool
{
    using UnityEngine;
#if UNITY_EDITOR
    using UnityEditor;
    [CustomPropertyDrawer(typeof(ChineseNameAttribute))]
    public class ChineseNameDrawer : PropertyDrawer
    {
        public override void OnGUI(Rect position, 
            SerializedProperty property, 
            GUIContent label)
        {
            // 获取自定义属性
            ChineseNameAttribute nameAttr = (ChineseNameAttribute)attribute;
        
            // 创建带中文名称的GUI内容
            GUIContent newLabel = new GUIContent(nameAttr.displayName);
        
            // 使用新标签绘制属性
            EditorGUI.PropertyField(position, property, newLabel);
        }
    }
#endif
    
    public class ChineseNameAttribute : PropertyAttribute
    {
        public readonly string displayName;
        public ChineseNameAttribute(string name)
        {
            displayName = name;
        }
    }
}

